home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 May / PersonalComputerWorld-May2008-CoverdiscCD.iso / Software / Full / Nero 7 / Installation / Cab / A97B5616.cab / Hilite07DD9089.js < prev    next >
Encoding:
JavaScript  |  2006-06-28  |  2.8 KB  |  76 lines

  1. /* Though the cursor is invisible until you move the mouse, extensibility pages get a mouseover event
  2.  
  3. when they load. If your invisible cursor is over a focusable item, this mouseover event can cause the
  4.  
  5. focus to land on the wrong item when the page loads. The bFirstMouseover variable (originally set in the
  6.  
  7. MoveFocus.js file) is used to identify that initial mouseover event and nullify it. 
  8.  
  9. The first mouseover event fires when the page loads. Then there is a statement in the 
  10.  
  11. StartFocus function, in the MoveFocus.JS file, which uses the setTimeout method to wait until
  12.  
  13. after that first mouseover event fires and then resets bFirstMouseover to false, so the subsequent 
  14.  
  15. mouseovers will be handled normally */
  16.  
  17.  
  18.  
  19. function mouseOver(item)
  20.  
  21. {
  22.  
  23.     // if this is the first mouseover event that fires automatically when the page loads, return
  24.  
  25.     if (bFirstMouseover == true) return
  26.  
  27.  
  28.  
  29.     // make sure item is focusable
  30.  
  31.     if (event.srcElement.MCFocusable != "true" || event.srcElement.MCTempUnFocusable == "true") return
  32.  
  33.     // update oCurFocus variable
  34.  
  35.     oCurFocus = item
  36.  
  37.     // since user used mouse instead of an arrow key, reset sPrevArrowDirection variable to null
  38.  
  39.     sPrevArrowDirection = null
  40.  
  41.     // move focus to new item
  42.  
  43.     item.focus()
  44.  
  45. }
  46.  
  47.  
  48.  
  49. function hilite(item)
  50.  
  51. {
  52.  
  53.     // if item is not focusable, return
  54.  
  55.     if (event.srcElement.MCFocusable != "true") return
  56.  
  57.  
  58.  
  59.     var sClass = item.className
  60.  
  61.     //check if class name already ends in "_hilite" -- if so, quit function
  62.  
  63.     if (checkSubstring(sClass) == true) return
  64.  
  65.       
  66.  
  67.     // change element's class name for highlighting
  68.  
  69.    item.className = sClass + "_hilite"
  70.  
  71.     try
  72.  
  73.     {
  74.  
  75.             /*as needed, update the numeric value for the item counter found at the lower right of
  76.  
  77.             each scrollable menu in the templates */
  78.  
  79.            updateCounter()
  80.  
  81.     }
  82.  
  83.     catch(e)
  84.  
  85.     {
  86.  
  87.         //ignore error
  88.  
  89.     }
  90.  
  91. }
  92.  
  93.  
  94.  
  95. function restore(item)
  96.  
  97. {
  98.  
  99.     //if (event.srcElement.MCFocusable != "true") return
  100.  
  101.     var sClass = item.className
  102.  
  103.     //check if class name ends in "_hilite" -- if not, quit function
  104.  
  105.     if (checkSubstring(sClass) == false) return
  106.  
  107.     // remove "_hilite" (last 8 characters) from class name to return to unhighlighted state
  108.  
  109.    item.className = sClass.substring(0,(sClass.length -7))
  110.  
  111. }
  112.  
  113.  
  114.  
  115. function checkSubstring(sClass)
  116.  
  117. {
  118.  
  119.     // this function checks whether a class name ends in "_hilite"
  120.  
  121.     if (sClass.substring((sClass.length -7), sClass.length) == "_hilite")
  122.  
  123.     {
  124.  
  125.         return true
  126.  
  127.     }
  128.  
  129.     return false
  130.  
  131. }
  132.  
  133.  
  134.  
  135. function checkSelected(sClass)
  136.  
  137. {
  138.  
  139.     // this function checks whether a class name ends in "_selected"
  140.  
  141.     if (sClass.substring((sClass.length -9), sClass.length) == "_selected")
  142.  
  143.     {
  144.  
  145.         return true
  146.  
  147.     }
  148.  
  149.     return false
  150.  
  151. }